import request from '@/utils/request'


/**
 * 
 * 
 * @description 用户登陆
 */


//登录
export function LOGIN(data) {
  return request({
    method: 'post',
    url: '/login',
    // url: 'api/v1/login/login',
    //转换数据的方法
    transformRequest: [
      function (data) {
        let ret = '';
        for (let it in data) {
          ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&';
        }
        return ret;
      }
    ],
    //设置请求头
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: data
  })
}

//增

export function ADD_FILE_TYPE(data) {
  return request({
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    transformRequest: [function (data) {
      data = JSON.stringify(data)
      return data
    }],
    url: 'api/v1/type/addFileType',
    method: 'post',
    params: {},
    data: data
  })
}

//查
export function TODAY_TEMP(data) {
    return request({
      method: 'post',
      url: 'http://106.55.49.97:8086/exponentialTemperature/todatTemp',
      // url: '/exponentialTemperature/todatTemp',
      //转换数据的方法
      transformRequest: [
        function (data) {
          let ret = '';
          for (let it in data) {
            ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&';
          }
          return ret;
        }
      ],
      //设置请求头
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      data: data
    })
  }
  

//改

export function EDIT_FILE_TYPE(data) {
  return request({
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    transformRequest: [function (data) {
      data = JSON.stringify(data)
      return data
    }],
    url: 'api/v1/type/updateFileType',
    method: 'post',
    params: {},
    data: data
  })
}

//删
export function DEL_FILE_TYPE(data) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: 'api/v1/type/delFileTypeById/' + data,
    method: 'post',
    params: {},
    data: ''
  })
}
